using System.Collections;
using Evaluant.Uss;
using Evaluant.Uss.Commands;
using Evaluant.Uss.Models;
using System.Globalization;
using Evaluant.OPath;

namespace Evaluant.Uss
{
    public interface IPersistenceEngine
    {
        EntitySet Load(string opath);
        EntitySet Load(string opath, string[] attributes);
        EntitySet Load(string opath, string orderby, int first, int max);

        // The only override to be implemented
        EntitySet Load(string opath, string[] attributes, string orderby, int first, int max);
        EntitySet Load(OPathQuery opath, string[] attributes, string orderby, int first, int max);

        Entity LoadWithId(string type, string id);
        EntitySet LoadWithId(string type, string[] id);

        // The only override to be implemented
        EntitySet LoadWithId(string type, string[] id, string[] attributes);

        void LoadReference(Entity entity);
        void LoadReference(Entity entity, params string[] references);
        void LoadReference(IEnumerable entities);

        // The only override to be implemented
        void LoadReference(IEnumerable entities, string[] references);

        object LoadScalar(string opath);
        object LoadScalar(OPathQuery opath);

        /// <summary>
        /// Deletes all the data contained in by the underlying repository
        /// </summary>
        void InitializeRepository();

        /// <summary>
        /// Removes from memory all entities referenced by this engine
        /// </summary>
        void Initialize();

        void BeforeProcessCommands(Transaction tx);
        void ProcessCommands(Transaction tx);
        void AfterProcessCommands(Transaction tx);

        Model Model { get; }
        CultureInfo Culture { get; }
    }
}
